<template>
	<view class="">
		<image src="/static/img/my/bg.png" class="w-max pa top0 left0" style="max-height: 100%;" mode="widthFix" />
		<u-navbar :is-back="false" :border-bottom="false" title="我的" titleBold :is-fixed="false"
			:background="{background:'#0000'}" />
		<view class="pr p30 pt0">

			<view class="flex pb20">
				<u-avatar size="100" :src="$user.avatar_img||''"></u-avatar>
				<view class="fs30 fw-700 pl24">{{$user.name}}</view>
			</view>
			<view class="flex">
				<view class="bg-fff h148 radius12 box-shadow w50p flex"
					@click="$u.route('/pages/my/addPatient/patientList')">
					<image src="/static/img/my/1.png" class="h104 w104" mode=""></image>
					<view class="pl44 ">
						<view class="fs28">
							就诊人
						</view>
						<view class="fs30 fw-600 mt16">{{$user.patient_num||0}}</view>
					</view>
				</view>
				<view class="bg-fff h148 radius12 box-shadow w50p ml20 flex"
					@click="$u.route('/pages/my/coupon/coupon?show=1')">
					<image src="/static/img/my/2.png" class="h104 w104" mode=""></image>
					<view class="pl10">
						<view class="">
							<text class="fs28">优惠券</text>
							<text class="fs24 color-999">(未使用)</text>
						</view>
						<view class="color-fs fw-700 mt16">{{$user.coupon_num||0}}
						</view>
					</view>
				</view>
			</view>

			<view class="h234 mt20 pr" v-if="$config.is_withdraw==1">
				<image src="/static/img/my/money_bg.png" class="wh-max" mode=""></image>
				<view class="pa wh-max top0 left0 p24">
					<view class="flex row-between pl154">
						<view class="">
							<view class="">账户余额（元）</view>
							<view class="mt10 color-red fw-w">
								<text class="fs24">￥</text>
								<text class="fs34">{{$user.deposit||'0'}}</text>
							</view>
						</view>
						<view class="">
							<u-button type="error" plain ripple shape="circle"
								@click="$u.route('/pages/my/balance/tixian')">提现</u-button>
						</view>
					</view>
					<view class="flex row-between mt24">
						<view class="w312 h64 radius100 bg-f7f flex row-center"
							@click="$u.route('/pages/my/balance/balance')">
							<image src="/static/img/my/sy.png" class="w36 h36 mr24" mode=""></image>
							<view class="fs24 color-666">收益明细</view>
						</view>
						<view class="w312 h64 radius100 bg-f7f flex row-center"
							@click="$u.route('/pages/my/balance/tixianLog')">
							<image src="/static/img/my/tx.png" class="w36 h36 mr24" mode=""></image>
							<view class="fs24 color-666">提现记录</view>
						</view>
					</view>
				</view>
			</view>
			<view class="" v-for="(item,index) in mylist" :key="index">
				<view class="flex py24 border-b" @click="click(item)">
					<image :src="item.icon" class="h46 w46" mode=""></image>
					<view class="color-666 fs28 pl22 flex1">
						{{item.name}}
					</view>
					<view class="color-zs" v-if="item.type=='wx'">{{$user.is_bind==1?'已':'未'}}绑定</view>
					<image src="/static/img/my/right.png" class="h22 w22 ml20" mode=""></image>
				</view>
			</view>
			<tabbar />
		</view>
	</view>
</template>

<script>
export default {
		onShow() {
			this.$getConfig()
			this.$getUser()
		},
		onLoad() {},
		onPageScroll: function(e) {
			this.scrollTop = e.scrollTop
		},
		methods: {
			click(item) {
				item.methods ? item.methods() : this.$u.route(item.url, item.params)
			},
		},
		data() {
			return {
				scrollTop: 0,
				titleColor: "#232323",
				background: {
					backgroundImage: 'linear-gradient(91deg, #00C2CF 0%, #1ED2BE 100%)',
				},
			};
		},
		computed: {
			mylist() {
				let list = [{
						name: '领劵中心',
						icon: '/static/img/my/coupon.png',
						url: '/pages/my/coupon/coupon?show=0'
					},
					{
						name: '绑定手机号',
						icon: '/static/img/my/mobile.png',
						url: '/pages/my/bindMobile/bindMobile'
					},
					{
						name: '推广达人',
						icon: '/static/img/my/wechat.png',
						url: '/pages/my/popularize/list',
						type: 'popularize',
						hide:this.$config.is_promoter != 1
					},
					{
						name: '我的地址',
						icon: '/static/img/my/address2.png',
						url: '/pages/my/address/address?tit=我的地址'
					},
					{
						name: '联系客服',
						icon: '/static/img/my/lxkf.png',
						url: '',
						methods: () => {
							console.log(11);
							this.$showModal('联系客服').then(res => {
								this.$tool.phone(this.$config.shop_mobile)
							})
						},
					},
					{
						name: '关于我们',
						icon: '/static/img/my/about.png',
						url: '/pages/public/text',
						params: {
							text: 'about_us',
							tit: '关于我们'
						}
					},
					{
						name: '用户协议',
						icon: '/static/img/my/fuxy.png',
						// url: '/pages/my/about/about',
						url: '/pages/public/text',
						params: {
							text: 'service_agreement',
							tit: '用户协议'
						}
					},
					{
						name: '隐私政策',
						icon: '/static/img/my/yszc.png',
						url: '/pages/public/text',
						params: {
							text: 'privacy_policy',
							tit: '隐私政策'
						}
					},
					{
						name: '设置',
						icon: '/static/img/my/set.png',
						url: '/pages/my/set/set'
					},
				]
				list=list.filter(it=>!it.hide)
				return list
			}
		},
	}
</script>

<style lang="scss">
	page {
		background: #fff;
	}
</style>